-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: upgrade to latest version of mermaid to add new diagrams #1252
base: master
Are you sure you want to change the base?
Conversation
I just did similar for 9.2.2 to support However, arrows do not appear and there are other stylistic oddities. See before and after results for In investigating, I found two clues:
But I'm not sure if I fully understand the issue. |
Yeah I think that unique id issue is a red herring. After a bit more investigation I found that the PDF export is also missing the arrowheads, but that the HTML export shows them... except in Safari! There's various reports of this over time. Some indicate Armed with this vague data, I studied the DOM in both Safari and Opera. It's identical in both, but for some reason Safari does not see or use the Original:
Working:
In other words, simply wrapping the marker definitions in So I guess it's probably up to mermaid to fix this, since that's what generates the But if anyone has a better suggestion I'd love to hear it. |
Eh, FWIW, the existence of the |
OMG, I nearly gave up on this so many times. Every potential cause ended up being another red herring. It seems So I finally gave up and went to create a MRE to leave for posterity, and in crafting exactly the right MRE... accidentally stumbled on the cause! It turns out that the arrows appear in all cases, except in recent mermaid versions when the syntax highlighting script is present. Somehow this clashing with the mermaid script, and despite the resulting DOM looking fine, the arrows only appear in Chrome/Opera, but not in MacDown/Safari. Here's a JSFiddle demonstrating this, with the syntax highlighting script (copied out of a HTML export from MacDown). It pulls mermaid 9.2.2 from CDN, but otherwise attempts to recreate what MacDown does manually. If you run the fiddle on Safari, and uncomment the So I suspect if syntax highlighting could be disabled blocks where mermaid is in effect, we'd be golden. But I haven't investigated yet. <SNIP beautified script because I realise now it's Prism> |
That does it. The syntax highlighting script is of course, Prism, and it turns out this co-existence issue with mermaid is known. By following that issue, I came across the Filter highlightAll plugin. Sure enough, if I replace the contents of the I'm not sure how to apply this fix to MacDown itself... |
Ah yes, there it is. Alas the built-in template for the script tag doesn't allow insertion of an attribute without a re-build, not to mention the fact that the list of Prism plugins is fixed. But... it does just pull in the Prism code from file, so could I embed the fix in the file itself? Yes!! I replaced the contents of
Refreshed the document in MacDown, and voila, arrows everywhere! |
I just updated the mermaid version to 8.11.0 to allow new type of diagrams like
erDiagram
We might want to create a github actions to automate such updates